package com.zzb.controller;

import com.zzb.DTO.ResultDTO;
import com.zzb.VO.NewsVO;
import com.zzb.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author ASUS
 */
@RestController
@CrossOrigin
@RequestMapping("/back/news")
public class NewsController {

    @Autowired
    private NewsService newsService;

    @GetMapping("/all")
    public ResultDTO productTypeFindAll(NewsVO newsVO) {
        return newsService.findAll(newsVO);
    }

    @GetMapping("/id")
    public ResultDTO productTypeFindById(NewsVO newsVO) {
        return newsService.findById(newsVO);
    }

    @PostMapping("/add")
    public ResultDTO productAdd(NewsVO newsVO) {
        return newsService.add(newsVO);
    }

    @PostMapping("/update")
    public ResultDTO productUpdate(NewsVO newsVO) {
        return newsService.update(newsVO);
    }

    @PostMapping("/delete")
    public ResultDTO productDelete(NewsVO newsVO) {
        return newsService.delete(newsVO);
    }
}
